<?php

class Stack 
{
	private $_size;
	
    public function __construct() 
    {
    	$this->_top = -1;
    }
    
    public function push($val)
    {
    	++ $this->_top;
    	array_push($this->_array, $val);
    }
    
    public function pop()
    {
    	$ret = array_pop($this->_array);
    	
    	if($ret){
    		-- $this->_top;
    	}
    	
    	return $ret;
    }
    
    public function top()
    {
    	return $this->_array[$this->_top];
    }
    
}
?>